package com.shujia.util

import org.apache.spark.sql.SparkSession

object SparkUtil {

  /**
   * 获取spark的环境
   *
   * @param isLocal ：是否本地
   * @return
   */
  def getSession(isLocal: Boolean = false): SparkSession = {

    if (isLocal) {
      SparkSession
        .builder()
        .master("local")
        .getOrCreate()
    } else {
      SparkSession
        .builder()
        .enableHiveSupport()
        .getOrCreate()
    }

  }
}
